#pragma once

#ifndef _CR_HTTP_AUTHENTICATION_H_
#define _CR_HTTP_AUTHENTICATION_H_

NS_CR_BEGIN

namespace http
{
	class Authentication
	{
	public:
		template <typename UserType, typename PassType>
		Authentication(UserType&& username, PassType&& password)
			: username_{ _STD_FWD(username) }
			, password_{ _STD_FWD(password) }
			, auth_string_{ username_ + ":" + password_ }
		{}

		const char* GetAuthString() const NOEXCEPT
		{
			return auth_string_.data();
		}

	private:
		string username_;
		string password_;
		string auth_string_;
	};

	class Digest : public Authentication 
	{
	public:
		template <typename UserType, typename PassType>
		Digest(UserType&& username, PassType&& password)
			: Authentication{ _STD_FWD(username), _STD_FWD(password) } 
		{}
	};
}

NS_CR_END

#endif // !_CR_HTTP_AUTHENTICATION_H_
